/**
 * @projectName demo-master
 * @fileName Application.java
 * @packageName org.example.nacos.data
 * @author xaoyaoyao
 * @date 2021/3/23 14:22
 * @version V1.0
 * @copyright (c) 2021, xaoyaoyao@aliyun.com All Rights Reserved.
 */
package org.example.nacos.data;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;

/**
 * @author xaoyaoyao
 * @className Application
 * @description
 * @date 2021/3/23 14:22
 */
@SpringBootApplication
public class Application {

	@Bean
	public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
		RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
		redisTemplate.setConnectionFactory(factory);
		redisTemplate.setKeySerializer(new StringRedisSerializer());
		redisTemplate.setHashKeySerializer(new StringRedisSerializer());
		return redisTemplate;
	}

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}
}
